/**
 * WebSocketRequest.js
 * @author Ulyan Sobin
 * @description WebSocketRequest class
 */

"use strict";

const http = require("http");
const { WebRequest } = require("../WebRequest");

class WebSocketRequest extends WebRequest {

	/** @type {http.IncomingMessage} */
	origin;

	/** @type {http.IncomingHttpHeaders} */
	headers;

	/**
	 * Constructor of `WebSocketRequest`
	 * @param {http.IncomingMessage} request 
	 */
	constructor (request) {
		if (!(request instanceof http.IncomingMessage))
			throw new Error("Type error: \'request\'");
		super(request.url);
		this.origin = request;
		this.headers = request.headers;
	}
}

module.exports.WebSocketRequest = WebSocketRequest;